﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Edit.aspx.cs" Inherits="SysAdmin_User_Edit" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <script type="text/javascript">

        var user_edit_temp = false;

        $(function () {
            //初始化数据
            $('#user_edit_rolecombobox').combobox({
                url: 'Ashx/GetRoleComboBox.ashx',
                valueField: 'id',
                textField: 'text',
                onLoadSuccess: function () {
                    //首次加载成功后加载默认选择的
                    var roleDefaul = document.getElementById("user_edit_role_default").value;
                    if (roleDefaul != "") {
                        $('#user_edit_rolecombobox').combobox('setValue', roleDefaul);
                    }
                    else { user_edit_temp = true; }
                },
                onSelect: function (node) {
                    if (user_edit_temp) {
                        //加载选择的角色权限
                        if (node) {
                            $.ajax({
                                type: "POST",
                                url: 'Ashx/GetRolePower.ashx',
                                data: "roleCode=" + node.id,
                                dataType: "json",
                                success: function (msg) {
                                    $('#user_edit_powercombox').combotree('setValues', msg);
                                }
                            });
                        }
                    }
                    else { user_edit_temp = true; }

                }
            });

            $('#user_edit_powercombotree').combotree({
                url: 'Ashx/GetAllPower.ashx',
                parentField: 'pid',
                lines: true,
                multiple: true,
                onlyLeafCheck: true,
                onLoadSuccess: function () {
                    //首次加载成功后加载默认选择的
                    var powerDefault = document.getElementById("user_edit_power_default").value;
                    if (powerDefault != "") {
                        var setPowerDefault = (new Function("return " + powerDefault))();
                        $('#user_edit_powercombotree').combotree('setValues', setPowerDefault);
                    }
                }
            });
        });
    </script>
    <div style="text-align: center;">
        <form id="admin_user_editForm" method="post">
            <table class="tableForm" style="width: 100%;">
                <tr>
                    <th style="width: 150px;">用户名</th>
                    <td>
                        <input type="hidden" id="user_edit_key" name="user_edit_key" value="<%=user_id %>" />
                        <%=user_name %></td>
                    <th style="width: 100px;">密码</th>
                    <td>
                        <input name="user_pwd" type="password" class="easyui-validatebox" style="width: 150px;" /></td>
                </tr>
                <tr>
                    <th>真实姓名</th>
                    <td>
                        <input name="user_full_name" id="user_real_name" value="<%=user_fullname %>" style="width: 150px;" /></td>
                    <th>性别</th>
                    <td>
                        <input id="user_edit_sexcombobox" value="<%=user_sex %>" name="user_sex" class="easyui-combobox" data-options="url:'Ashx/GetDicComboBox.ashx?dic_key=sex',valueField: 'id',textField: 'text'" /><img src="Images/cut_red.png" onclick="$('#user_edit_sexcombobox').combobox('clear');" />
                    </td>
                </tr>
                <tr>
                    <th>角色</th>
                    <td>

                        <input name="user_edit_rolecombobox" id="user_edit_rolecombobox" /><img src="Images/cut_red.png" onclick="$('#user_edit_rolecombobox').combobox('clear');" />
                    </td>
                    <th>出生日期</th>
                    <td>
                        <input id="user_edit_birthday" value="<%=user_birthday %>" name="user_edit_birthday" type="text" class="easyui-datebox" /><img src="Images/cut_red.png" onclick="$('#user_edit_birthday').datebox('clear');" />
                    </td>
                </tr>
                <tr>
                    <th>权限</th>
                    <td colspan="3">
                        <input id="user_edit_powercombotree" name="user_edit_powercombotree" data-options="url:'Ashx/GetAllPower.ashx',parentField : 'pid',lines : true,multiple:true,onlyLeafCheck:true" style="width: 370px;" /><img src="Images/cut_red.png" onclick="$('#user_edit_powercombotree').combotree('clear');" />
                    </td>
                </tr>
            </table>
            <input type="hidden" id="user_edit_role_default" value="<%=user_role %>" />
            <input type="hidden" id="user_edit_power_default" value="<%=user_powers %>" />
        </form>
    </div>
</body>
</html>
